export default function getJSON(url) {
  return new Promise((resolve,reject)=>{
    const xhr = new XMLHttpRequest()
  xhr.open('GET', url)
  xhr.onreadystatechange = () => {
    if (xhr.readyState === 4) {
      if (xhr.status >= 200 && xhr.status < 300) {
        resolve(xhr.response)
      } else {
        reject(new Error(xhr.statusText))
      }
    }
  }
  xhr.responseType = 'json'
  xhr.setRequestHeader('Accept', 'application/json')
  xhr.send()
  })
  
}